import request from '../utils/request';
import axios from 'axios';
const baseUrl = "http://139.215.190.237:8081/api";
// const baseUrl = "http://buxn.natapp1.cc/api";
//POST /md/findAreasByData  地点统计数据，根据条件查询  //  第二个页面
//鉴权 GET /auth/getJsConfig
export const auth_getJsConfig = params => {
    const url = `${baseUrl}/auth/getJsConfig`;
    return axios.get(url, { params: params });
};
//免登POST /auth/login
export const auth_login = params => {
    const url = `${baseUrl}/auth/login`;
    return axios.get(url, { params: params });
};
/// 查询所有评论
export const commentsFindPagePc = params => {
  const url = `${baseUrl}/management/comments/findPage`;
  return axios.post(url, params);
};
//文件上传 /api/management/news/uploadfile
export const uploadfile = params => {
  // const url = `${baseUrl}/management/news/uploadfile`;
  const url=`${baseUrl}/management/addNews/uploadfile`
  // const url=`${baseUrl}/management/files/breakpoint-upload`
  return axios.post(url, params);
};
///评论审批
export const approve = params => {
  const url = `${baseUrl}/management/comments/approve`;
  return axios.get(url, { params: params });
};
// /  删除评论
export const commentsDelete = params => {
  const url = `${baseUrl}/management/comments/delete`;
  return axios.get(url, { params: params });
};
//   评论驳回
export const commentsRejected = params => {
  const url = `${baseUrl}/management/comments/rejected`;
  return axios.get(url, { params: params });
};
///  评论置顶
export const commentsTop = params => {
  const url = `${baseUrl}/management/comments/top`;
  return axios.get(url, { params: params });
};
////  取消置顶
export const commentsUntop = params => {
  const url = `${baseUrl}/management/comments/untop`;
  return axios.get(url, { params: params });
};
//分类分页查询
export const findPage = params => {
    const url = `${baseUrl}/management/category/findPage`;
    return axios.post(url, params);
};

// 新增分类 /api/management/category/add 
export const categoryAdd = params => {
    const url = `${baseUrl}/management/category/add`;
    return axios.post(url, params);
};
// 分类删除
export const deletes = params => {
    const url = `${baseUrl}/management/category/delete`;
    return axios.get(url, {params:params});
};
//分类修改
export const edit = params => {
    const url = `${baseUrl}/management/category/edit`;
    return axios.post(url, params);
};
// 栏目停用 /api/management/category/disable
export const categoryDisable = params => {
  const url = `${baseUrl}/management/category/disable`;
  return axios.get(url, {params:params});
};
// 栏目启用​/api​/management​/category​/enable
export const categoryEnable = params => {
  const url = `${baseUrl}/management/category/enable`;
  return axios.get(url, {params:params});
};

// 新闻创建 api​/management​/news​/add
export const addNews = params => {
    const url = `${baseUrl}/management/addNews/add`;
    return axios.post(url, params);
};
/// . /api/management/addNews/submit 新闻提交审核
export const newsSubmit = params => {
  const url = `${baseUrl}/management/addNews/submit`;
  return axios.get(url, {params:params});
};
// 新闻分页查询 /api/management/addNews/findPage
export const newsFindPage = params => {
    const url = `${baseUrl}/management/addNews/findPage`;
    return axios.post(url, params);
};
//  新闻审批 /api/management/approveNews/approve
export const newsApprove = params => {
    const url = `${baseUrl}/management/approveNews/approve`;
    return axios.get(url, {params:params});
};
//  新闻驳回
export const newsRejected = params => {
    const url = `${baseUrl}/management/approveNews/rejected`;
    return axios.get(url, {params:params});
};
// id查看新闻详情 /api/management/news/findById
export const newsFindById = params => {
    const url = `${baseUrl}/management/approveNews/findById`;
    return axios.get(url, {params:params});
};
/// 新闻删除
export const newsDelete = params => {
    const url = `${baseUrl}/management/approveNews/delete`;
    return axios.get(url, {params:params});
};
//  新闻停用
export const newsDisable = params => {
    const url = `${baseUrl}/management/approveNews/disable`;
    return axios.get(url, {params:params});
};
///新闻分类根据权限查询查询  /api/management/addNews/findCategoryData
export const findCategoryData = params => {
  const url = `${baseUrl}/management/addNews/findCategoryData`;
  return axios.get(url, {params:params});
};
//新闻启用 
export const newsEnable = params => {
    const url = `${baseUrl}/management/approveNews/enable`;
    return axios.get(url, {params:params});
};
//  新闻修改 /api/management/news/edit
export const newsEdit = params => {
    const url = `${baseUrl}/management/addNews/edit`;
    return axios.post(url, params);
};
//  新闻发布
export const newsPublish = params => {
    const url = `${baseUrl}/management/addNews/publish`;
    return axios.get(url, {params:params});
};
//  钉钉分享推送/api/management/approveNews/sendMsg
export const  sendMsg= params => {
  const url = `${baseUrl}/management/approveNews/sendMsg`;
  return axios.post(url, params);
};
////新闻置顶
export const newsTop = params => {
    const url = `${baseUrl}/management/approveNews/top`;
    return axios.get(url, {params:params});
};
///新闻取消置顶
export const newsUntop = params => {
    const url = `${baseUrl}/management/approveNews/untop`;
    return axios.get(url, {params:params});
};
//////////////角色////////////
//查询授权人信息  /api/management/role/findUserIdsAll
export const findUserIdsAll = params => {
    const url = `${baseUrl}/management/role/findUserIdsAll`;
    return axios.get(url, {params:params});
};
///修改授权人信息   /api/management/role/add
export const editRoles = params => {
    const url = `${baseUrl}/management/role/editRoles`;
    return axios.post(url, params);
};

//用户统计页面使用/userTicket/queryForCensus
//统计各状态人数
export const userCensus = params => {
    const url = `${baseUrl}/userTicket/queryForCensus`;
    return axios.get(url, {params:params});
};

//POST /md/findDetailsByData 魔点进出数据明细，根据条件查询   首页面


export const  findDetailsByData= params => {
    const url = `${baseUrl}/md/findDetailsByData`;
    return axios.post(url, params);
};

//   POST /md/findDevicesByData  设备统计数据，根据条件查询    详情

export const  findDevicesByData= params => {
    const url = `${baseUrl}/md/findDevicesByData`;
    return axios.post(url, params);
};

// POST /md/findOnlineByData   查询在井人数，根据条件查询
export const  findOnlineByData= params => {
    const url = `${baseUrl}/md/findOnlineByData`;
    return axios.post(url, params);
};
// GET /md/findStrandedByData  查询在井人数详情，根据条件查询
export const findStrandedByData = params => {
    const url = `${baseUrl}/md/findStrandedByData`;
    return axios.get(url, {params:params});
};

////////////////客户端/////////////
////api/news/findPage 新闻查询
export const  MbFindPage= params => {
  const url = `${baseUrl}/news/findPage`;
  return axios.post(url, params);
};
/// /api/news/findById 新闻详情
export const  newsfindById= params => {
  const url = `${baseUrl}/news/findById`;
  return axios.get(url, {params:params});
};
// 评论查询 

export const commentsFindPage = params => {
  const url = `${baseUrl}/news/detailPageById`;
  return axios.post(url, params);
};
//  评论创建
export const addComments = params => {
  const url = `${baseUrl}/news/addComments`;
  return axios.post(url, params);
};
///评论删除 /api/management/comments/delete
export const commentsDeletes = params => {
  const url = `${baseUrl}/management/comments/delete`;
  return axios.get(url, { params: params });
}
//评论点赞 /api/news/supportComments
export const supportComments = params => {
  const url = `${baseUrl}/news/supportComments`;
  return axios.get(url, { params: params });
}
//  取消评论点赞 /api/news/cancelComments
export const cancelComments = params => {
  const url = `${baseUrl}/news/cancelComments`;
  return axios.get(url, { params: params });
}
// 新闻点赞 /api/news/support
export const newsSupport = params => {
  const url = `${baseUrl}/news/support`;
  return axios.get(url, { params: params });
}
// 新闻取消点赞  api​/news​/cancel
export const newsCancel = params => {
  const url = `${baseUrl}/news/cancel`;
  return axios.get(url, { params: params });
}

// 查询可分享组织
export const findOrgData = params => {
  const url = `${baseUrl}/management/addNews/findOrgData`;
  return axios.get(url, { params: params });
}

export const checkFile = params => {
  const url = `${baseUrl}/management/files/check-file`;
  return axios.get(url, { params: params });
}
export const addFile = params => {
  const url = `${baseUrl}/management/files/add`;
  return axios.post(url,params);
}

export const breakpointUploadFile = params => {
  const url = `${baseUrl}/management/files/breakpoint-upload`;
  return axios.post(url,params);
}
